package com.gestion.abs.web.actions;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.gestion.abs.bll.api.GestionAbsence;
import com.gestion.abs.bll.api.gestionClasse;
import com.gestion.abs.bo.Absence;
import com.gestion.abs.bo.Classe;
import com.gestion.abs.bo.Etudiant;

public class ClasseAction {
	
	
	public String test(){
		
		
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		
		gestionClasse gest=(gestionClasse) context.getBean("gestionClasse");
		
		try {
			
				Etudiant e1=new Etudiant("aoulad", "saloua", new Date(), "f", "5785645", "4fdfdfd", Long.valueOf(2)," adresse");
				
				Etudiant e2=new Etudiant("boujdaini", "farida", new Date(), "f", "5785645", "4fdfdfd", Long.valueOf(2)," adresse");
				Etudiant e3=new Etudiant("benamar", "hafsa", new Date(), "f", "5785645", "4fdfdfd", Long.valueOf(2)," adresse");
				

				List<Etudiant> list=new ArrayList<>();
				list.add(e1);
				list.add(e2);
				list.add(e3);
				
				Classe clas=new Classe(Long.valueOf(3),"GI2",list);
			gest.ajouterClass(clas);
			
			System.out.println("coucouuuuuuuuuuuuu!");
			
		} catch (Exception e) {
			return "error";
		}
		
		return "success";
	
	}
public static void main(String[] args) {
	
	ClasseAction cl=new ClasseAction();
	cl.test();
}
}
